//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#ifndef __DHOSTMGR_H__
#define __DHOSTMGR_H__

class CHostingManager : public IHostingManager
{
public:
    CARAPI_(PInterface) Probe(
        /* [in] */ REIID riid);

    CARAPI_(UInt32) AddRef();

    CARAPI_(UInt32) Release();

    CARAPI Aggregate(
        /* [in] */ AggrType type,
        /* [in] */ PInterface pObj);

    CARAPI GetDomain(
        /* [out] */ PInterface *ppObj);

    CARAPI GetOne(
        /* [out] */ IAppletHosting **ppHost);

    CARAPI Register(
        /* [in] */ IAppletHosting *pHost);

    CARAPI Unregister(
        /* [in] */ IAppletHosting *pHost);

    CHostingManager() : 
#ifdef DEBUG_KMUTEX
        m_hostLock(__FILE__, __LINE__),
#endif //DEBUG_KMUTEX
        m_hostEvent(FALSE, 0) {}

    virtual ~CHostingManager() {}

private:
    KMutex      m_hostLock;
    DzEvent     m_hostEvent;
};

const int c_nWaitHostTimeout = 500;

#endif //__DHOSTMGR_H__
